package com.bestow.lease.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bestow.common.annotation.Log;
import com.bestow.common.core.controller.BaseController;
import com.bestow.common.core.domain.AjaxResult;
import com.bestow.common.enums.BusinessType;
import com.bestow.lease.domain.HlsBpMasterContactInfo;
import com.bestow.lease.service.IHlsBpMasterContactInfoService;
import com.bestow.common.utils.poi.ExcelUtil;
import com.bestow.common.core.page.TableDataInfo;

/**
 * 商业伙伴联系信息Controller
 * 
 * @author liliu
 * @date 2022-09-26
 */
@RestController
@RequestMapping("/lease/bpMasterContactInfo")
public class HlsBpMasterContactInfoController extends BaseController
{
    @Autowired
    private IHlsBpMasterContactInfoService hlsBpMasterContactInfoService;

    /**
     * 查询商业伙伴联系信息列表
     */
    @PreAuthorize("@ss.hasPermi('lease:bpMasterContactInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(HlsBpMasterContactInfo hlsBpMasterContactInfo)
    {
        startPage();
        List<HlsBpMasterContactInfo> list = hlsBpMasterContactInfoService.selectHlsBpMasterContactInfoList(hlsBpMasterContactInfo);
        return getDataTable(list);
    }

    /**
     * 导出商业伙伴联系信息列表
     */
    @PreAuthorize("@ss.hasPermi('lease:bpMasterContactInfo:export')")
    @Log(title = "商业伙伴联系信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, HlsBpMasterContactInfo hlsBpMasterContactInfo)
    {
        List<HlsBpMasterContactInfo> list = hlsBpMasterContactInfoService.selectHlsBpMasterContactInfoList(hlsBpMasterContactInfo);
        ExcelUtil<HlsBpMasterContactInfo> util = new ExcelUtil<HlsBpMasterContactInfo>(HlsBpMasterContactInfo.class);
        util.exportExcel(response, list, "商业伙伴联系信息数据");
    }

    /**
     * 获取商业伙伴联系信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('lease:bpMasterContactInfo:query')")
    @GetMapping(value = "/{contactInfoId}")
    public AjaxResult getInfo(@PathVariable("contactInfoId") Long contactInfoId)
    {
        return AjaxResult.success(hlsBpMasterContactInfoService.selectHlsBpMasterContactInfoByContactInfoId(contactInfoId));
    }

    /**
     * 新增商业伙伴联系信息
     */
    @PreAuthorize("@ss.hasPermi('lease:bpMasterContactInfo:add')")
    @Log(title = "商业伙伴联系信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody HlsBpMasterContactInfo hlsBpMasterContactInfo)
    {
        return toAjax(hlsBpMasterContactInfoService.insertHlsBpMasterContactInfo(hlsBpMasterContactInfo));
    }

    /**
     * 修改商业伙伴联系信息
     */
    @PreAuthorize("@ss.hasPermi('lease:bpMasterContactInfo:edit')")
    @Log(title = "商业伙伴联系信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody HlsBpMasterContactInfo hlsBpMasterContactInfo)
    {
        return toAjax(hlsBpMasterContactInfoService.updateHlsBpMasterContactInfo(hlsBpMasterContactInfo));
    }

    /**
     * 删除商业伙伴联系信息
     */
    @PreAuthorize("@ss.hasPermi('lease:bpMasterContactInfo:remove')")
    @Log(title = "商业伙伴联系信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{contactInfoIds}")
    public AjaxResult remove(@PathVariable Long[] contactInfoIds)
    {
        return toAjax(hlsBpMasterContactInfoService.deleteHlsBpMasterContactInfoByContactInfoIds(contactInfoIds));
    }
}
